#ifndef __IJPEGD_CLI_H__
#define __IJPEGD_CLI_H__

#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>

#include <ijpegd.h>

typedef void *hnd_t;

typedef struct cli_input_t cli_input_t;

typedef struct {
	FILE		*input_file;
	FILE		*output_file;
	int			i_csp;
	int			input_file_size;

	/* buf managememt */
	/* must be vitural addr */
	bool b_use_phy;
	void *(*ckmalloc)(int index, int size, int align);
	void (*ckfree)(int index, void *);
	intptr_t (*ckvirt_to_phys)(intptr_t vaddr);
	intptr_t (*ckphys_to_virt)(intptr_t paddr);
} cli_opt_t;

static inline char *get_filename_extension(char *filename)
{
    char *ext = filename + strlen(filename);
    while( *ext != '.' && ext > filename )
        ext--;
    ext += *ext == '.';
    return ext;
}

#endif /* __IJPEGD_CLI_H__ */
